package com.cc.monitor.entity.message;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * MetricsData
 *
 * @author aa
 * @version 1.0
 * @since 2024/11/21
 */
@Data
public class MetricsData {

    // monitoring id
    private Long id;
    // tenant id
    private Long tenantId;
    // monitoring app eg: linux | mysql | jvm
    private String app;
    // monitoring metrics eg: cpu | memory | health
    private String metrics;
    // monitoring collect priority >=0
    private Byte priority;
    // collect timestamp
    private Long time;
    // collect response code
    private Code code;
    // collect response error message
    private String msg;
    // monitoring collect metric field
    private List<Field> fields;
    // monitoring collect metric data, mapping with the fields
    private List<ValueRow> values;

    public MetricsData() {
        fields = new ArrayList<>();
        values = new ArrayList<>();
    }

    public void addValues(ValueRow valueRowBuilder) {
        values.add(valueRowBuilder);
    }

    public void addAllFields(List<Field> fieldList) {
        fields.addAll(fieldList);
    }

    public void clearValues() {
        values.clear();
    }
}
